package com.sy.bean.message.util;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Map;

@Data
public class Page {
    @ApiModelProperty(value = "当前第几页,默认第1页")
    int page;

    @ApiModelProperty(value = "每页记录数,默认10条",required = false)
    int pageSize;

    /**
     * 将javabean转换为map
     * @return
     */
    public Map toMap(){
        //先转换父类
        Map parentMap= MapUtils.convertToMap(getClass().getSuperclass(),this);
        //获取当前类
        Map childMap=MapUtils.convertToMap(getClass(),this);
        parentMap.putAll(childMap);
        return parentMap;
    }
}
